#include "bar.h"
#include <unistd.h>
//download
double bandwidth=1024*1024*1.0;
void download(double filesize,callback_t cd)
{
    double current=0.0;
    double bandwidth=1024*1024*1.0;

    printf("download done,current:%lf\n",current);
    while(current<=filesize)
    {
        cd(filesize,current);
        //从网络中获取数据
        current+=bandwidth;
        usleep(10000);
    
    }


    printf("\ndownload done,filesize:%lf\n",filesize);

}


int main()
{
    //ForTest();
    //ProgBar(100.0,10.34);
    //ProgBar(100.0,20.34);
    //ProgBar(100.0,99.98);
    //ProgBar(100.0,56.74);
    //ProgBar(100.0,69.98);
    download(100*1024*1024,ProgBar);
    download(50*1024*1024,ProgBar);
    download(800*1024*1024,ProgBar);
    download(890*1024*1024,ProgBar);
    download(67*1024*1024,ProgBar);
    download(10*1024*1024,ProgBar);
    return 0;
}
